import request from "@/request/";

export const getFlowList = (data) => {
  return request({
    url: "/api/mes-production-service/craft-route/page",
    method: "POST",
    data,
  });
};

export const createFlow = (data) => {
  return request({
    url: "/api/mes-production-service/craft-route/flow/define/create",
    method: "POST",
    data,
  });
};

export const removeFlow = (list) => {
  return request({
    url: "/api/mes-production-service/craft-route/remove",
    method: "POST",
    data: {
      idList: list,
    },
  });
};

export const updateFlow = (data) => {
  return request({
    url: "/api/mes-production-service/craft-route/state/update",
    method: "POST",
    data,
  });
};

export const getFlowDetail = (id) => {
  return request({
    url: "/api/mes-production-service/craft-route/detail",
    method: "POST",
    data: {
      craftRouteId: id,
    },
  });
};

export const getProductList = (data) => {
  return request({
    url: "/api/mes-production-service/craft-route/product/relate/page",
    method: "POST",
    data,
  });
};

export const removeProduct = (list) => {
  return request({
    url: "/api/mes-production-service/craft-route/product/relate/remove",
    method: "POST",
    data: {
      idList: list,
    },
  });
};

export const updateProduct = (id, defaultFlag) => {
  return request({
    url: "/api/mes-production-service/craft-route/product/relate/default—flag/update",
    method: "POST",
    data: {
      id,
      defaultFlag,
    },
  });
};

export const getProductDetail = (data) => {
  return request({
    url: "/api/mes-production-service/craft-route/product/relate/detail",
    method: "POST",
    data,
  });
};

export const createProduct = (data) => {
  return request({
    url: "/api/mes-production-service/craft-route/product/relate/create",
    method: "POST",
    data,
  });
};
